﻿// <copyright file="ContribEcoSpace.cs" company="Codeplex project Eco.Contrib"> 
// The MIT License (MIT) 
// </copyright> 
// <author>Peter Buchmann</author> 

namespace Eco.Contrib
{
    using Eco.ObjectRepresentation;

    /// <summary>
    /// EcoSpace for project Eco.Contrib
    /// </summary>
    public class ContribEcoSpace : Eco.Handles.DefaultEcoSpace
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ContribEcoSpace"/> class.
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors", Justification = "Call of RegisterEcoService is OK"), 
         System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "EcoScriptLanguageService is disposed by EcoSpace")]
        public ContribEcoSpace()
            : base()
        {
            this.RegisterEcoService<Eco.Cache.ICache>(this.FrontsidePolicy.Cache);
            this.RegisterEcoService<IEcoScriptLanguageService>(new EcoScriptLanguageService(this));
            OclOperationInstaller.Install(this);
        }

        /// <summary>
        /// Gets Locator for IObject.
        /// </summary>
        /// <param name="objectInstance">The objekt instance.</param>
        /// <returns>Locator for IObject</returns>
        public Cache.Locator LocatorForIObject(IObjectInstance objectInstance)
        {
            return FrontsidePolicy.LocatorForIObject(objectInstance);
        }
    }
}
